import { asyncRoutes,constantRoutes} from '@/router/index'
const state ={
    router:[]
}
const mutations ={
    addRouter(state,newRouter){
        state.router = [...constantRoutes,...newRouter]
    }
}
const actions ={
    filterRouter(store,menus){
        const res = asyncRoutes.filter(item =>{
            if(menus.indexOf(item.name) !== -1){
                return item
            }
        })
        store.commit('addRouter',res)
        console.log(18,res);
        return res
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
  }